package com.hpf.gupao.principle.rely;

/**
 * @description:
 * @datetime: 2021/5/16 14:02
 * @author: huangpengfei
 */
public class Tom {

    /**
     * 构造抽象
     */
    private ICourse course;

    private String name;

    public Tom() {
    }

    public Tom(ICourse course, String name) {
        this.course = course;
        this.name = name;
    }

    public void study(){
        System.out.println("I'm " + name + ", i ready to study");
        course.study();
    }

    /**
     * 方法抽象
     * @param course
     */
    public void study(ICourse course) {
        System.out.println("I'm " + name + ", i ready to study");
        course.study();
    }

    /**
     * set抽象，只创建一个对象==》针对单例对象
     * @param course
     */
    public void setCourse(ICourse course){
        this.course = course;
    }
}
